<%@ page language="java" contentType="text/html; charset=UTF-8"	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="perm" uri="/WEB-INF/tld/perm.tld"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<script>var ctx="${ctx}";</script>
 <button onclick="clickInsertWordGet(this)" type="button" class="btn btn-outline btn-block btn-primary">添加</button>
 <div class="ibox-content">
	<table id="discussStopWord_table" data-action="${ctx}/discuss/categoryFind" data-datatable="true"  class="footable table table-stripped toggle-arrow-tiny">
	  	<thead>
		  	<tr>
				<th data-sort-ignore="true"  data-title="lable" >名称</th>
				<th data-sort-ignore="true"  data-title="createTime" data-type="datetime" >创建时间</th>
				<th data-sort-ignore="true" data-title="status"  data-type="enum" data-opt='{"1":"启用","2":"停用"}'>状态</th>
			  	<th data-sort-ignore="true"  data-crud="true" data-title='{"uid":"id"}'>操作
      			  <div style="display: none;" class="center hidden-phone">
      			  	 <perm:hasPermission code="discuss/categoryUpdateGet">
      			  	 	<button onclick="clickUpdateWordGet(this)" data-id=":uid" type="button" style="margin-right:5px" class="btn btn-primary btn-xs">更新</button>
      			  	 </perm:hasPermission>
				  </div> 
     		   </th>
		  	</tr>
	  	</thead>
	  	<tbody>
	  	</tbody>
  	</table>
</div>
		
	<script>
	
		$(document).ready(function() {
			init_page_table();
		});
		
		var clickUpdateWordGet=function(me){
			eModal.ajax({
	   	        url: "${ctx}/discuss/categoryUpdateGet?id="+$(me).data("id"),
	   	        title:'修改货咖说栏目',
	   	        loading:true,
	   	        subtitle: '',
	   	     	size: eModal.size.sm,
	   	        buttons: [
	   	            {text:'保存',style:'info',close:false,click:function(){
	   	            	if (!jQuery.checkall(true)) return;
	   	 		    	$.ajax({  
	   	 					url:'${ctx}/discuss/categoryUpdate',  
	   	 					data:{
	   	 						lable:$("#lable").val(),							
								status:$("#status").val(),								
								id:$("#id").val()
							},   
							type: 'POST',
	   	 					dataType:'json',  
	   	 					success:function(response){
	   	 						if(response.code==0){
	   	 							eModal.close();
	   	 						}else{
	   	 						    $.confirm({cancelButton: "关   闭",title: '提示!',content: "添加货咖说栏目错误!"});
	   	 						}
	   	 					}  
	   	 			    }); 
	   	            }},{text: '取消', style: 'danger', close: false, click:function(){
	   	            	eModal.close();
	   	            }}
	   	        ],
	   	    });
		}
		
		var clickInsertWordGet=function(){
			eModal.ajax({
	   	        url: "${ctx}/discuss/categoryInsertGet",
	   	        title:'添加货咖说栏目',
	   	        loading:true,
	   	        subtitle: '',
	   	     	size: eModal.size.sm,
	   	        buttons: [
	   	            {text: '保存',style:'info',close:false,click:function(){
	   	            	if (!jQuery.checkall(true)) return;
	   	 		    	$.ajax({  
	   	 					url:'${ctx}/discuss/categoryInsert',  
	   	 					data:{
								lable:$("#lable").val(),							
							},   
							type: 'POST',
	   	 					dataType:'json',  
	   	 					success:function(response){
	   	 						if(response.code==0){
	   	 							eModal.close();
	   	 						}else{
	   	 						    $.confirm({cancelButton: "关   闭",title: '提示!',content:"修改货咖说栏目错误!"});
	   	 						}
	   	 					}  
	   	 			    }); 
	   	            }},{text: '取消', style: 'danger', close: false, click:function(){
	   	            	eModal.close();
	   	            }}
	   	        ],
	   	    });
		}
		
		$(function(){
		
			jQuery.searchFormInit();
		    
		});
	</script>
	
	</body>
</html>